﻿using System;
using System.IO;

namespace Hongsh.Pay.Client.Proxy.Http {
    // Token: 0x02000035 RID: 53
    public class HttpStreamResult : HttpContentResult {
        // Token: 0x1700009F RID: 159
        // (get) Token: 0x0600017B RID: 379 RVA: 0x000030EF File Offset: 0x000012EF
        // (set) Token: 0x0600017C RID: 380 RVA: 0x000030F7 File Offset: 0x000012F7
        public Stream ContentStream { get; set; }

        // Token: 0x0600017D RID: 381 RVA: 0x00003100 File Offset: 0x00001300
        public HttpStreamResult(Stream stream) : base("application/octet-stream") {
            //Class15.cwcZ3SWztHroi();
            //base..ctor("application/octet-stream");
            ContentStream = stream;
        }

        // Token: 0x0600017E RID: 382 RVA: 0x0000BD0C File Offset: 0x00009F0C
        public override void WriteReponse(HttpContext ctx) {
            base.WriteReponse(ctx);
            ctx.Response.ContentLength = (int)(ContentStream.Length - ContentStream.Position);
            byte[] array = new byte[4096];
            int count;
            while ((count = ContentStream.Read(array, 0, array.Length)) > 0) {
                ctx.Response.Write(array, 0, count);
            }
        }
    }
}
